Setup

# install.packages("tidyverse")

library(tidyverse)

gapminder <- readRDS(here::here("data", "gapminder_dat.rds"))

gapminder_europe <- gapminder %>%
  filter(world_4region == "europe", time >= 1900, time <= 2024) %>%
  drop_na(gini)

gapminder_2020 <- gapminder %>%
  filter(time == 2020) %>%
  drop_na(world_6region, world_4region, country, gini, hapiscore_whr) %>% 
  arrange(desc(co2_cons))

Story


Just as writing is made more compelling by a strong narrative, this principle also applies to the accompanying figures.

Foto von Henry Be auf Unsplash

Exploration

Abbildung von Laura Navarro Soler.

Story-Arc

Abbildung von Corey Jones.

Grafik entfalten lassen

Bewerten der Informationen

Zusätzliche Informationen einbauen

Labeln: annotate()

gapminder_line <- gapminder %>%
  filter(country %in% c("deu"), time >= 1900, time <= 2024) %>%
  drop_na(gini)

gapminder_europe <- gapminder %>%
  filter(world_4region == "europe", time >= 1900, time <= 2024) %>%
  drop_na(gini)

ggplot(data = gapminder_line, aes(x = time, y = gini)) +
  geom_line(data = gapminder_europe, aes(x = time, y = gini, group = country), color = "lightgrey", alpha = 0.5) +
  geom_smooth(color = "black") +
  geom_line(color = "#F4BA02", linewidth = 2) +
  theme_bg() +
  labs(
    title = "Ungleichheit in Europa On the Rise",
    subtitle = "1900 bis 2024",
    x = "Jahr",
    y = "Gini-Koeffizient"
  ) +
  annotate(
    geom = "text", x = 1920, y = 49, label = "Deutschland",
    color = "#F4BA02", fontface = "bold", size = 4
  ) +
  annotate("segment",
    x = 1920, xend = 1918, y = 47, yend = 44,
    color = "#F4BA02", arrow = arrow(length = unit(0.2, "cm"))
  )

🏋 Übung

Baut ein Label in euren Plot ein.

Vergleichen

🏋 Übung

  1. Was wäre die Überschrift für eure Grafik, wenn sie in der Zeitung stehen würde?
  2. Welche Infos sind noch notwendig, um die Grafik zu verstehen? Wo könnte man sie einbauen?
  3. Soll die Abbildung aus mehreren Plots bestehen? In welcher Reihenfolge?